﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management.Automation;
using System.Management.Automation.Provider;
using System.ServiceModel;
using System.Xml;
using System.Net;
using System.Xml.Linq;
using System.Collections;

namespace SharePoint.Utilities.Cmdlets
{
    [Cmdlet(VerbsCommon.Remove, "SiteColumns")] 
    public class RemoveColumnsCommand : PSCmdlet
    {

        [Parameter(Mandatory = true, HelpMessage = "Specify Destination SiteCollection")]
        public string DestinationSiteCollectionUrl { get; set; }


        [Parameter(Mandatory=true,HelpMessage ="Specify Columns Group Names")]
        public string ColumnGroupNames { get; set; }


        protected override void ProcessRecord()
        {
            ImportContentTypeHelper.DeleteColumns(DestinationSiteCollectionUrl, ColumnGroupNames, this);
             
        }
    }

    

    [Cmdlet(VerbsCommon.Remove, "SiteContentTypes")] 
    public class RemoveContentTypesCommand : PSCmdlet
    {

        [Parameter(Mandatory = true, HelpMessage = "Specify Destination SiteCollection")]
        public string DestinationSiteCollectionUrl { get; set; }


        [Parameter(Mandatory = true, HelpMessage = "Specify Content Type Group Names")]
        public string ContentTypeGroupNames { get; set; }


        protected override void ProcessRecord()
        {
            ImportContentTypeHelper.DeleteSiteContentTypes(DestinationSiteCollectionUrl, ContentTypeGroupNames, this);  
        }
    }


    [Cmdlet("Migrate", "SiteColumns")]
    public class MigrateSiteColumnsCommand : PSCmdlet
    {

        [Parameter(Mandatory = true, HelpMessage = "Specify Source SiteCollection")]
        public string SourceSiteCollectionUrl { get; set; }

        [Parameter(Mandatory = true, HelpMessage = "Specify Destination SiteCollection")]
        public string DestinationSiteCollectionUrl { get; set; }


        [Parameter(Mandatory = true, HelpMessage = "Specify Content Columns Group Name")]
        public string ColumnGroupNames { get; set; }

        protected override void ProcessRecord()
        {
            ImportContentTypeHelper.MigrateSiteColumns(SourceSiteCollectionUrl, DestinationSiteCollectionUrl, ColumnGroupNames);
        }


    }

    [Cmdlet("Migrate", "SiteContentTypes")]
    public class MigrateSiteContentTypesCommand : PSCmdlet
    {

        [Parameter(Mandatory = true, HelpMessage = "Specify Source SiteCollection")]
        public string SourceSiteCollectionUrl { get; set; }

        [Parameter(Mandatory = true, HelpMessage = "Specify Destination SiteCollection")]
        public string DestinationSiteCollectionUrl { get; set; }


        [Parameter(Mandatory = true, HelpMessage = "Specify Content Type Group Names")]
        public string ContentTypeGroupNames { get; set; }


        protected override void ProcessRecord()
        {
            ImportContentTypeHelper.MigrateSiteContentTypes(SourceSiteCollectionUrl , DestinationSiteCollectionUrl, ContentTypeGroupNames);
        }
    }
}
